<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Roles extends Model
{
    use SoftDeletes;
    protected $table = 'roles';
    protected $fillable=[ 'name', 'slug' ];

    public function manyPermissions()
    {
        return $this->belongsToMany(Permissions::class,'role_permissions','role_id','permission_id');
    }

    public function manyMenus()
    {
        return $this->belongsToMany(Menus::class,'role_menu','role_id','menu_id');
    }

    public function manyUsers()
    {
        return $this->belongsToMany(Users::class,'role_users','role_id','user_id');
    }

}
